package sul.hot;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

public class Profile extends Activity implements View.OnClickListener{
    /** Called when the activity is first created. */
	int index;
	Button back,exit;
	Bundle extras;
	ImageView image;
	TextView nam,add,str,serv,rooT,niP,toP;
	String names[] = {"Sul Palace","High Creest","Karkuk Plaza","Azadi Hotel","Azmer Palace","Mazi Plaza"};
	String address[] = {"Salm Str","Bakrajo Str","Salm Str","Abusana str","Azmer Mount","Sul Market"};
	String stars [] = {"4","5","4","4","3","2"};
	String service [] = {"breakfast","breakfast","breakfast","breakfast","breakfast","breakfast"};
	String roomsType [] = {"family","family","4 person","3 person","family","2 person"};
	String niPrice [] = {"300 $","450 $","60 $","100 $","120 $","20 $"};
	String toPrice [] = {"670 $","900 $","150 $","220 $","180 $","20 $"};
	int imgs [] = {R.drawable.palce,R.drawable.highcrest,R.drawable.karkuk1,R.drawable.azadi,
					R.drawable.azmar,R.drawable.mazi};
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.profile);
        extras = getIntent().getExtras();
        nam = (TextView)findViewById(R.id.name);
        add = (TextView)findViewById(R.id.add);
        str = (TextView)findViewById(R.id.str);
        serv = (TextView)findViewById(R.id.srv);
        rooT = (TextView)findViewById(R.id.rooT);
        niP = (TextView)findViewById(R.id.nP);
        toP = (TextView)findViewById(R.id.tP);
        image = (ImageView)findViewById(R.id.img);
        back = (Button)findViewById(R.id.button1);
        back.setOnClickListener(this);
        exit = (Button)findViewById(R.id.button2);
        exit.setOnClickListener(this);
        hoProf();
    }
    
    public void hoProf()
    {
    	 String value = extras.getString("Value1");
         index = Integer.parseInt(value);
         
    	 nam.setText(names[index]);add.setText(address[index]);str.setText(stars[index]);
         serv.setText(service[index]);rooT.setText(roomsType[index]);niP.setText(niPrice[index]);
         toP.setText(toPrice[index]);
         image.setImageResource(imgs[index]);
    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(back.getId() == ((Button)v).getId()){
		Intent myIntent = new Intent(v.getContext(),Hotels.class);
		startActivityForResult(myIntent, 0);
		}else
		if(exit.getId() == ((Button)v).getId()){
			Intent myIntent = new Intent(v.getContext(),SulaymaniaHotels.class);
			startActivityForResult(myIntent, 0);
			
			Intent intent = new Intent(Intent.ACTION_MAIN);
			intent.addCategory(Intent.CATEGORY_HOME);
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			startActivity(intent);
		}
	}
}
